﻿using FluentValidation;
using Turquoise.Entities.Complex.UserModels;
using Turquoise.Globalization;

namespace Turquoise.Validation.FluentValidation.UserValidation.Rules
{
    public class UpdateRules : AbstractValidator<UpdateModel>
    {
        public UpdateRules()
        {
            RuleFor(p => p.User.Username).NotEmpty().WithMessage(Resources.UsernameNotEmpty);
            RuleFor(p => p.User.Username).Length(8, 32).WithMessage(Resources.UsernameLength);
            RuleFor(p => p.User.Email).NotEmpty().WithMessage(Resources.EmailNotEmpty);
            RuleFor(p => p.User.Email).EmailAddress().WithMessage(Resources.EmailInValid);
            RuleFor(p => p.User.FirstName).NotEmpty().WithMessage(Resources.FirstNameNotEmpty);
            RuleFor(p => p.User.LastName).NotEmpty().WithMessage(Resources.LastNameNotEmpty);

        }
    }
}
